
import { MongooseFactory } from "../kalend";
import { Schema } from "mongoose";

// 后台用户表
const schema = MongooseFactory.Schema({
    // 昵称
    name: {
        type: String,
        required: true
    },
    // 姓名
    realname: {
        type: String
    },
    // 性别
    sex: {
        type: String,
        menu: [null, '男', '女'],
        default: null
    },
    // 手机
    phone: {
        type: String,
        default: ''
    },
    password: {
        type: String
    },
    roleId: [{
        type: Schema.Types.ObjectId,
        ref: "role"
    }],
    //备注
    remark: {
        type: String
    },
    //银行卡号
    bankno: {
        type: String
    },
    //银行
    bank: {
        type: String
    },
    // 状态  1：有效  0：禁用
    status: {
        type: Number,
        default: 1
    },
    // 关联商户（商户法人有此字段）
    merchantid: {
        type: Schema.Types.ObjectId,
        ref: "merchant"
    },
    //关联用户id
    customerid: {
        type: Schema.Types.ObjectId,
        ref: "customer_account"
    },
    //账户余额-业绩奖励（餐厅买单收入）
    balance: {
        type: Number,
        default: 0
    },
    //账户余额-招募奖励
    balancezm: {
        type: Number,
        default: 0
    },
    //提现冻结金额
    frozenamount: {
        type: Number,
        default: 0
    },
    //关联会员手机号
    relatephone: {
        type: String
    },
    // 城市级别 1：省会 2：地级市 3：县级市
    citytype: {
        type: Number,
        default: 3
    },
    //省
    province: {
        type: String
    },
    //市
    city: {
        type: String
    },
    //区县
    district: {
        type: String
    }
});



export const platform_userModel = MongooseFactory.Model("platform_user", schema);